home *** CD-ROM | disk | FTP | other *** search
Text File | 1987-11-20 | 1.4 KB | 84 lines | [TEXT/ttxt] |
- Program SoundParser;
-
- Uses
- Memtypes, Quickdraw, OSIntf, Toolintf, PackIntf;
- {$D+}
- {$R-}
-
- Var
- Dummy1:str255;
-
-
-
- Procedure Parse(var First:str255);
- Var
- namelength, resultlen, lastcount, count, vcount:longint;
- name, trans, zero, testchar:str255;
- vset:Array[0..6] of str255;
- found, done:Boolean;
-
-
- Begin
-
- {Load the array's with similar sounds.}
-
- vset[0]:='AEHIOUWYaehiouwy';
- vset[1]:='BFPVbfpv';
- vset[2]:='CGJKQSXZcgjkqsxz';
- vset[3]:='DTdt';
- vset[4]:='Ll';
- vset[5]:='MNmn';
- vset[6]:='Rr';
-
- {Initialize remaining variables.}
-
- resultlen:=0;
- lastcount:=0;
- namelength:=Length(First)-1;
- name:=Copy(First,2,namelength);
- count:=0;
- done:=False;
- zero:='';
-
- While ((count<namelength)&(Not(done))) do
- begin
- count:=count+1;
- testchar:=Copy(name,count,1);
- found:=False;
- vcount:=-1;
- While ((vcount<6)&(Not(found))) do
- Begin
- vcount:=vcount+1;
- If ((Pos(testchar,vset[vcount]))>0) then
- found:=True;
- End;
-
- If (Not(found)) then
- vcount:=0;
-
- If ((vcount<>0)&(lastcount<>vcount)) then
- Begin
- NumToString(vcount, trans);
- Zero:=Concat(Zero, trans);
- resultlen:=resultlen+1;
- If (resultlen=3) then
- done:=True;
- End;
- lastcount:=vcount;
- End;
-
- While (resultlen<3) do
- Begin
- resultlen:=resultlen+1;
- Zero:=Concat(Zero, '0')
- End;
-
- {Put first character in front of computed code.}
-
- First:=Concat(Copy(First,1,1),Zero);
-
- end;
-
- Begin
- Parse(Dummy1)
- End.